﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TrucksDir.Data;
using TrucksDir.Resources;
using System.Web.Routing;

namespace TrucksDir.Controllers
{
    public class HomeController : Controller
    {
        trucksmodel _db;

        public HomeController()
        {
            _db = new trucksmodel();
        }
        
        public ActionResult Index()
        {
            registerProductCategorySelectListViewBag();
            return View();
        }

        public ActionResult About()
        {
            return View();
        }

        public ActionResult AddTruck()
        {
            return RedirectToAction("Create", "Trucks");
        }

        private void registerProductCategorySelectListViewBag()
        {
            List<SelectListItem> languages = new List<SelectListItem>();
            SelectListItem en = new SelectListItem() { Text = Common.EnglishLangName, Value = Common.EnglishLangKey};
            
            SelectListItem es = new SelectListItem() { Text = Common.SpanishLangName, Value = Common.SpanishLangKey };
            languages.Add(en);
            languages.Add(es);
            
            ViewBag.LanguageList = languages;
        }
    }
}
